/*
 * **下图为VFD-PU01背面插针**
 *         ____
 * _______|    |________
 * |                    |
 * |2   4   6   8   10  |
 * |                    |
 * |1   3   5   7   8   |
 * |____________________|
 * 
 * VFD-PU01_1：空
 * VFD-PU01_2：空
 * VFD-PU01_3：SPI_SCK (ICSP:3)(ARDUINO MEGA 2560_52)
 * VFD-PU01_4：SPI_MOSI(ICSP:4)(ARDUINO MEGA 2560_51)
 * VFD-PU01_5：SPI_SCK (ICSP:3)(ARDUINO MEGA 2560_52)
 * VFD-PU01_6：SPI_MISO(ICSP:1)(ARDUINO MEGA 2560_50)
 * VFD-PU01_7：chipSelectPin 使能？，在config.h中定义ARDUINO MEGA 2560_53
 * VFD-PU01_8：空
 * VFD-PU01_9：+5V
 * VFD-PU01_10：GND
 * 
 * ___________________
 * 1-MISO * * 2-VCC
 * 3-SCK  * * 4-MOSI
 * 5-REST * * 6-GND
 *        ICSP
 * ___________________
 */
#include "NUMBER_Set_Key_Read.h"
#include "config_.h"


const int analogInPin = A0;
long sensorValue = 0;

void setup() {
  SPI.begin();
  pinMode(chipSelectPin, OUTPUT);
  Serial.begin(115200);
  
}
/*
 * #define led_shang     0x20
#define led_zhong     0x40
#define led_xia       0x80
#define led_1         0x01
#define led_2         0x02
#define led_3         0x04
#define led_4         0x08
#define led_5         0x10
Numb_non

 */
void loop() {

  sensorValue = analogRead(analogInPin);
  sensorValue = map(sensorValue, 0, 1023, 0, 500);
  //long num_ = sensorValue;
  long num_ = 55555;
  int led_s = led_shang;
  int key_val = ~long_NUMBER_Set_Key_Read(num_,long_NUMBER_Set_Key_Read(num_,led_s,0,sensorValue),0,sensorValue);
  
  int key_ctr = 0x01;
  for(int i = 0;i < 8;i ++){
    Serial.print("k");
    Serial.print(i+1);
    Serial.print(":");
    if((key_val&key_ctr)!=0x00){
    Serial.print("--;");    
    }else{
    Serial.print("++;");    
    }
    key_ctr = key_ctr<<1;
  }
    Serial.println(" ");    

  
}
